package cn.com.bluemoon.daps.model.entity;

import cn.com.bluemoon.daps.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 数据模型-模型表
 * </p>
 *
 * @author admin
 * @since 2020-08-03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors
@ApiModel(value = "DapDataModel", description = "数据模型-模型表")
public class DapDataModel extends BaseModel<DapDataModel> {

    private static final long serialVersionUID = 1L;


    @ApiModelProperty(value = "数据源id")
    @NotNull(message = "数据源不能为空")
    private String dataSourceId;

    @ApiModelProperty(value = "模型描述")
    @NotNull(message = "模型描述不能为空")
    private String description;

    @ApiModelProperty(value = "模型名称")
    @NotNull(message = "模型名称不能为空")
    private String name;

    /*@ApiModelProperty(value = "1表示公共模型，0/null表示非公共模型")
    @NotNull(message = "是否为公共模型不能为空")
    private Boolean commonModel;

    @ApiModelProperty(value = "是否使用公共模型，1表示是，0表示否")
    private Boolean isUseCommonModel;*/

    @ApiModelProperty(value = "模型类型，1表示er模型，2表示星型模型")
    @NotNull(message = "模型类型不能为空")
    private Integer modelType;

    @ApiModelProperty(value = "模型对应的系统分类,1: BUSINESS_SYS 业务系统,2: WAREHOUSE_SYS 数仓系统,3: DATA_PRODUCE 数据产品,4: OTHER 其他")
    @NotNull(message = "系统分类不能为空")
    private Integer sysType;

    @ApiModelProperty(value = "关联系统id")
    @NotNull(message = "系统名称不能为空")
    private String systemId;

    @ApiModelProperty(value = "业务线：1: 现代渠道,2: 电商,3: 财务,4: 供应链,5: 人事行政后勤,6: 社区（含高校等）,7: 洗衣服务,8: 月亮商城,9: 客服,10: 管理学院")
    private Integer businessLine;

    @ApiModelProperty("模型管理员")
    @NotNull(message = "模型管理员不能为空")
    private String modelAdmin;

    @ApiModelProperty(value = "是否进行同步生产操作，默认为是")
    private Boolean isSyncProd;

    /**
     * 翻译业务线
     * @return
     */
    public String getBizDescLine() {
        if (this.businessLine == null) return "";
        if (this.businessLine == 1) return "现代渠道";
        if (this.businessLine == 2) return "电商";
        if (this.businessLine == 3) return "财务";
        if (this.businessLine == 4) return "供应链";
        if (this.businessLine == 5) return "人事行政后勤";
        if (this.businessLine == 6) return "社区（含高校等）";
        if (this.businessLine == 7) return "洗衣服务";
        if (this.businessLine == 8) return "月亮商城";
        if (this.businessLine == 9) return "客服";
        if (this.businessLine == 10) return " 管理学院";
        return "";
    }
}
